<template>
	<view style="width: 100%;height: 100%;display: flex;center;align-items: center;">
		<view v-if="data" class="flex-column justify-center align-center" style="width: 100%;height: 100%;">
			<view>{{data.en}}</view>
			<view class="px20 py20">{{data.zh}}</view>
			<image class="px20 py20" :src="data.pic" mode="scaleToFill"/>
		</view>
	</view>
</template>
<script setup>
	import { onPullDownRefresh } from '@dcloudio/uni-app';
	import { ref } from 'vue';
	const data=ref(undefined);
	function getData() {
		uni.request({
			url: 'https://api.vvhan.com/api/dailyEnglish?type=sj',
			method: 'GET',
			success: res => {
				data.value=res.data.data;
			},
			complete: () => {
				uni.stopPullDownRefresh();
				uni.showToast({icon:null,title:'获取数据成功'});
			}
		});
	}
	
	onPullDownRefresh(()=>{getData();});
	getData();
</script>